#include "BoardView.h"

#include "../../models/network/CardViewModel.h"
#include "../../../domain/configuration/NetworkConfiguration.h"

using namespace Views::Client;
using namespace Utils;

BoardView::BoardView(Utils::GUI::Form* form, Domain::Network::GameClient* client)
	: Graphic::BoardView(form), client(client)
{
}

void BoardView::askForPlayerNewPosition(Players::Player* current_player, Cards::RoomsCards rooms_cards)
{
	this->rooms_cards = rooms_cards;
	Graphic::BoardView::askForPlayerNewPosition(current_player, rooms_cards);
}

void BoardView::onButtonClick(Cards::RoomCard* card)
{
	sf::Packet packet;
	Cards::CardsCollection cards(Cards::PlayersCards(), Cards::WeaponsCards(), rooms_cards);
	Views::Models::Network::CardViewModel cvm(card);
	packet << cvm;
	client->send(Domain::Configuration::Network::BOARD_ROOM_PICK, packet);

	Graphic::BoardView::onButtonClick(card);
}

